package com.pl.dailycollection.study.future.qicha;

import java.util.concurrent.Callable;
import java.util.concurrent.FutureTask;
import java.util.concurrent.TimeUnit;

/**
 * @ClassName ShaoShui
 * @Description: TODO
 * @Author pl
 * @Date 2020/1/2
 * @Version V1.0
 **/
public class ShaoShui implements Callable<String> {
    FutureTask<String> futureTask;

    public ShaoShui(FutureTask<String> futureTask) {
        this.futureTask = futureTask;
    }

    @Override
    public String call() throws Exception {
        System.out.println(Thread.currentThread().getName()+"洗水壶");
        TimeUnit.SECONDS.sleep(1);
        System.out.println(Thread.currentThread().getName()+"烧开水");
        TimeUnit.SECONDS.sleep(15);
        String tee = futureTask.get();
        System.out.println(Thread.currentThread().getName()+"拿到茶叶"+tee);
        System.out.println(Thread.currentThread().getName()+"泡茶");
        return "上茶"+tee;
    }
}
